package com.zqu.controller;

import com.zqu.pojo.ProductMaintenance;
import com.zqu.service.ProductMaintenanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("productmaintenance")
public class ProductMaintenanceController {
    @Autowired
    private ProductMaintenanceService productMaintenanceService;

    @RequestMapping("findproductmaintenance")
    @ResponseBody
    public ProductMaintenance selectById(){
        return productMaintenanceService.selectProductMaintenanceById(1);
    }

    @RequestMapping("selectlist")
    @ResponseBody
    public List<ProductMaintenance> selectlist(){
        return productMaintenanceService.selectList(new ProductMaintenance());
    }

    @RequestMapping("insertproductmaintenance")
    @ResponseBody
    public boolean insert(){
        return productMaintenanceService.insertProductMaintenance(new ProductMaintenance());
    }

    @RequestMapping("updateproductmaintenance")
    @ResponseBody
    public boolean update(){
        return productMaintenanceService.updateProductMaintenance(new ProductMaintenance());
    }

    @RequestMapping("deleteproductmaintenance")
    @ResponseBody
    public boolean delete(){
        return productMaintenanceService.deleteProductMaintenance(1);
    }

    @RequestMapping("deleteproductmaintenancebyids")
    @ResponseBody
    public boolean deletebyids(){
        String[] ids = {"1","2"};
        return productMaintenanceService.deleteProductMaintenanceByIds(ids);
    }
}
